
#include <serpent.h>

queue create_queue(str name) {
	queue q = (queue)create_obj(OBJ_Q);

	if ( q != NULL )
	{
		if( !prop_add(q, "name", name) )
		{
			return(NULL);
		}
		return(q);
	}
	else
	{
		return(NULL);
	}
}

bool destroy_queue(queue q) {
	if ( q != NULL )
	{
		props_destroy(q);
		s_free(q);
		return(true);
	}
	else
	{
		return(false);
	}
}

bool destroy_queues(void) {
	obj_t* e;
	unsigned long long co = 0;

	if( objects != NULL )
	{
		while( objects[co] != NULL )
		{
			e = objects[co];
			if( OBJ_Q == e->type )
			{
				if( !destroy_queue(e) )
				{
					return(false);
				}
			}
			co++;
		}
	}

	return(true);
}
